package com.yikome.shop.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.yikome.common.CommonRepository;
import com.yikome.shop.entity.CollectionProduct;

@Repository
public interface CollectionProductRepository extends CommonRepository<CollectionProduct, Long> {

	void deleteByCollectionId(Long collectionId);

	@Query("select t from CollectionProduct t where t.collectionId = :collectionId ")
	List<CollectionProduct> findCollectionProduct(@Param("collectionId") Long collectionId);
	
	@Query("select t from CollectionProduct t where t.productId = :productId ")
	List<CollectionProduct> findProductCollection(@Param("productId") Long productId);
}
